from selenium import webdriver
from selenium.webdriver.common.by import By
dr =webdriver.Firefox()
dr.get('http://stu000339/dbshop/public/')

username='Rover'
password='12345678'

def zhuce(username,password):
    # 1.点击注册
    dr.find_element(By.LINK_TEXT,'注册').click()
    # 2.输入会员名称
    dr.find_element(By.ID,'userName').send_keys(username)
    # 3.输入会员密码
    dr.find_element(By.ID,'userPassword').send_keys(password)
    # 4.确认会员密码
    dr.find_element(By.ID,'userComPassword').send_keys(password)
    # 5.输入电子邮箱
    dr.find_element(By.ID,'userEmail').send_keys(username+'@icloud.com')
    # 6.勾选注册协议
    dr.find_element(By.ID,'agreement').click()
    # 7.点击提交注册用户
    dr.find_element(By.CSS_SELECTOR,'button[class="btn btn-primary"]').click()
    # 8.退出
    dr.find_element(By.LINK_TEXT,'退出').click()

zhuce('Rover',12345678)